package com.daedalus.Gui.NderfaqeNgjyrat;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Nderfaqja extends JPanel implements ActionListener{
	
	JCheckBox kuqe,blu,verdhe;
	JButton buton1;
	
	public Nderfaqja(){
		
		setSize(400,300);
		setLayout(null);
		
		kuqe = new JCheckBox("E kuqe");
		kuqe.setSize(100, 30);
		kuqe.setLocation(50	, 20);
		add(kuqe);
		
		blu = new JCheckBox ("Blu");
		blu.setSize(100, 30);
		blu.setLocation(50, 60);
		add(blu);
		
		verdhe = new JCheckBox("e Verdhe");
		verdhe.setSize(100, 30);
		verdhe.setLocation(50, 100);
		add(verdhe);
				
		buton1=new JButton("Shfaq Ngjyren");
		buton1.setSize(250,40);
		buton1.setLocation(50,150);
		add(buton1);
		
		buton1.addActionListener(this);
	}
	

    public void actionPerformed(ActionEvent e) {
        if(e.getSource()==buton1) {
            String sms="Eshte shtypur ngjyra: ";
            if(!kuqe.isSelected() && !blu.isSelected() && !verdhe.isSelected()){
                sms = sms+"asnje";
            }
            else {
                if (kuqe.isSelected())		// nese po, shtoj mesazhin
                    sms=sms+"e kuqe ";
                if(blu.isSelected())
                    sms= sms+" blu ";
                if(verdhe.isSelected())
                    sms=sms+" e verdhe ";
            }
// shfaq mesazhin
            JOptionPane.showMessageDialog(this, sms);

        }
    }

	public static void main(String[] args){
		Nderfaqja p=new Nderfaqja();
		JFrame frame= new JFrame("Zgjidhni Ngjyren");
		frame.setSize(400, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.add(p);
		frame.setVisible(true);
	}
}